<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>作业回顾与完成</title>
  <style>
    .isActive {
      color: red;
    }
  </style>
</head>
<body>

<div id="app">
  <h1>点谁谁就是红色</h1>
  <ul>
    <li v-for="(item, index) in movies"
        :class="{isActive : currentIndex === index}"
        @click="btnclick(index)"
    >
      {{item}}
    </li>
  </ul>
</div>
<script src="../js/vue.js"></script>
<script>
  const app = new Vue({
    el: '#app',
    data: {
      movies: ['海王', '西游记', '葫芦娃', '红楼梦'],
      currentIndex: 0
    },
    methods: {
      btnclick(index) {
        this.currentIndex = index
      }
    }
  })
</script>
</body>
</html>
